package com.xxxx.server.config.security.config;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;


@Component
public class dateconverter implements Converter<String, LocalDate> {
    @Override
    public LocalDate convert(String source) {
        try {
            DateTimeFormatter dft = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            if (null != source && !"".equals(source)) {
                return LocalDate.parse(source, dft);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
